package demo7;

public class Test {
    public static void main(String[] args) {
        //String name;
        Thread t = new Thread(() -> {
            while(true){
                System.out.println("hello thread!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"这个是新的线程" );

        //设置为后台的线程，运行起来就不会进行打印
        t.setDaemon(true);

        t.start();
    }
}
